package com.newopenlab.hmc.util;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.newopenlab.hmc.biz.Player;

public class BaseHand {
	public List<String> lines=new ArrayList<String>();
	public String site=null;
	public String tableType=null;
	public Date time=null;
	public String code=null;
	public Integer buttonSeat=null;
	public String tablename=null;
	public Map<String,Player> seats=new HashMap<String,Player>();
	public Double totalPot=0d;
	public List<WayAction> actions=new ArrayList<WayAction>();
	public Map<String,PlayerHandResult> results=new HashMap<String,PlayerHandResult>();
	
	public Player getPlayerByName(String name){
		Player p=null;
		for(Player p1:seats.values()){
			if(p1.name.equals(name)){
				p=p1;
			}
		}
		return p;
	}
	
	public void showResume(){
		System.out.println("\n***** "+code);
		System.out.println(this.site);
		System.out.println(this.tableType);
		System.out.println(seats);
		for(WayAction wa:actions){
			System.out.println(wa.way+" "+wa.player.name+" "+wa.action+" "+wa.chips);
		}
		System.out.println(results);
	}
}
